<!DOCTYPE html>
<html>
	{include file="public/_header" /}
	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body ">
							<form class="layui-form" action="">
								<div class="layui-form-item">
									<label class="layui-form-label">分组</label>
									<div class="layui-input-block">
										<select name="group_id" lay-verify="required">
											<option value=""></option>
											{foreach $group as $key=>$vo}
											<option value="{$vo.gid}">{$vo.gname}</option>
											{/foreach}
										</select>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">中文标题</label>
									<div class="layui-input-block">
										<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="中文标题" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">英文字段</label>
									<div class="layui-input-block">
										<input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="英文字段" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">类别</label>
									<div class="layui-input-block">
										<select name="type_id" lay-verify="required">
											<option value=""></option>
											{foreach $type as $key=>$vo }
											<option value="{$vo.id}">{$vo.title}[{$vo.name}]</option>
											{/foreach}
										</select>
									</div>
								</div>

								<div class="layui-form-item">
									<label class="layui-form-label">配置项</label>
									<div class="layui-input-block">
										<textarea placeholder="键名:键值
键名:键值
键名:键值
...
										" class="layui-textarea" name="t_value"></textarea>
										<span>如果选择是 <strong style="color: red;">单选按钮,下拉框,复选框</strong> 时请必须填写该参数</span>
									</div>
								</div>

								<div class="layui-form-item">
									<label class="layui-form-label">描述</label>
									<div class="layui-input-block">
										<textarea name="remark" placeholder="描述" lay-verify="required" class="layui-textarea"></textarea>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">排序</label>
									<div class="layui-input-inline">
										<input type="number" name="sort" value="100" required lay-verify="required" placeholder="排序" autocomplete="off"
										 class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<div class="layui-input-block">
										<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
									</div>
								</div>
							</form>

						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			$(function() {
				layui.use('form', function() {
					var form = layui.form;

					//监听提交
					form.on('submit(demo1)', function(obj) {
						var lfc = top.layerFrameConfig;
						var iframeBIndex = lfc.iframeB.layer_index;
						var iframeCIndex = lfc.iframeB.index;
						var tableInfo = lfc.iframeB.info;
						$.post("{:url('admin/Config/addconfig')}", obj.field, function(res) {
							// if (res.status == 1) {
							// 	layer.msg(res.message, {
							// 		icon: 1,
							// 		time: 300
							// 	}, function() {
							// 		parent.layer.close(iframeCIndex);
							// 		tableInfo.reload()
							// 	});
							// } else {
							// 	layer.msg(res.message)
							// }
						})
						return false;
					});
				});


			})
		</script>

	</body>
</html>
